#include<iostream>
#include<stack>

using namespace std;
stack<int>aa;

int main()
{
	int sum = 0;
	while (1)
	{
		char c;
		cin >> c;
		//int sum = 0;
		if (c == '@')
		{
			break;
		}
		if (c >= '0' && c <= '9')
		{
			sum = sum * 10 + (c - '0');
			
		}
		else if (c == '.')
		{
			aa.push(sum);
			sum = 0;
		}

		else {
			int x = aa.top();
			aa.pop();
			int y = aa.top();
			aa.pop();

			if (c == '+')
			{
				int add = y + x;
				aa.push(add);
			}
			else if (c == '-')
			{
			int add = y - x;
				aa.push(add);
			}
			else if (c == '*')
			{
				int add = y * x;
				aa.push(add);
			}
			else if (c == '/')
			{
				int add = y / x;
				aa.push(add);
			}
		}
	}
	cout << aa.top();

	return 0;
}
